var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var r = t("GlobalUserData"),
s = t("GameConstant"),
l = cc._decorator,
c = l.ccclass,
d = l.property,
h = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.spine_left = null,
        e.spine_right = null,
        e.anim = null,
        e.posinit = null,
        e.nScaleLeft = 1,
        e.nScaleRight = 1,
        e
    }
    return n(e, t),
    e.prototype.onLoad = function() {
        this.nScaleLeft = this.spine_left.node.scale,
        this.nScaleRight = this.spine_right.node.scale
    },
    e.prototype.init = function() {
        this.node.active = !1,
        this.spine_left.node.active = !1,
        this.spine_right.node.active = !1,
        this.posinit = this.node.position,
        this.setRoleScale()
    },
    e.prototype.onGameOver = function() {
        this.anim.stop(),
        this.node.active = !1,
        this.destroy()
    },
    e.prototype.onGameBoutReady = function() {
        this.anim.stop(),
        this.node.active = !1,
        this.spine_left.node.active = !1,
        this.spine_right.node.active = !1,
        this.node.position = this.posinit,
        this.setRoleScale()
    },
    e.prototype.setRoleScale = function() {
        switch (r.default.nCurGameType) {
            case s.Game_Type.PK:
                this.spine_left.node.scale = this.nScaleLeft * s.Game_Type_Scale.PK,
            this.spine_right.node.scale = this.nScaleRight * s.Game_Type_Scale.PK;
            break;
            case s.Game_Type.PK_1:
                this.spine_left.node.scale = this.nScaleLeft * s.Game_Type_Scale.PK_1,
            this.spine_right.node.scale = this.nScaleRight * s.Game_Type_Scale.PK_1;
            break;
            case s.Game_Type.PK_2:
                this.spine_left.node.scale = this.nScaleLeft * s.Game_Type_Scale.PK_2,
            this.spine_right.node.scale = this.nScaleRight * s.Game_Type_Scale.PK_2;
            break;
            case s.Game_Type.Auto:
                this.spine_left.node.scale = this.nScaleLeft * s.Game_Type_Scale.Auto,
            this.spine_right.node.scale = this.nScaleRight * s.Game_Type_Scale.Auto;
        }
    },
    e.prototype.palyAniFail = function(t, e) {
        switch (this.node.active = !0, this.node.position = cc.v3(t.x, this.posinit.y, this.posinit.z), e) {
            case s.Physics_Car_Tag.Left:
                this.spine_left.node.active = !0,
            this.spine_right.node.active = !1,
            this.spine_left.setAnimation(0, "animation", !1),
            this.node.scaleX = 1;
            break;
            case s.Physics_Car_Tag.Right:
                this.spine_right.node.active = !0,
            this.spine_left.node.active = !1,
            this.spine_right.setAnimation(0, "animation", !1),
            this.node.scaleX = -1;
        }
        this.anim.play()
    },
    a([d(sp.Skeleton)], e.prototype, "spine_left", void 0),
    a([d(sp.Skeleton)], e.prototype, "spine_right", void 0),
    a([d(cc.Animation)], e.prototype, "anim", void 0),
    a([c], e)
} (cc.Component);
o.default = h